#include "testutils.h"

Ref<ByteMatrix> qImageToByteMatrix(QImage image)
{
    Ref<ByteMatrix> result(new ByteMatrix(image.width(), image.height()));
    for (int x = 0; x < image.width(); x++)
    {
        for (int y = 0; y < image.height(); y++)
        {
            QRgb pixel = image.pixel(x, y);
            int val = qGray(pixel);
            (*result)(x, y) = val;
        }
    }
    return result;
}
